<template>
    <div>
        <input type="text" placeholder="电话" v-model="tel">
        <input type="text" v-model="telval">
        <button @click="login">发送验证码</button>
        <button @click="login1">登录</button>
    </div>
</template>
<script>
export default {
    data(){
        return{
            tel:'',
            telval:'',
            code:''
        }
    },
    methods:{
        login(){
            this.axios.post('/user/login',`tel=${this.tel}`).then(result=>{
                console.log(result.data);
                this.code = result.data;
            })
        },
        login1(){
            if(this.telval==this.code){
                this.$router.push('/')
            }
        }
    }
}
</script>